package com.dhcc.utils;

import com.dhcc.file.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ShedulerClean {

    @Value("${file.dir}")
    String fileDir;

    @Autowired
    private FileService fileService;

    @Autowired
    private RedisTemplate redisTemplate;

    @Scheduled(cron = "0 0/1 * * * ?")   //每晚23点执行一次
    public void clean() {
        log.info("》》》》执行一次清空文件夹《《《《《");
//        DeleteFileUtil.deleteDirectory(fileDir + CommonUtils.getNowTimeTillDay());
//        Boolean delete = redisTemplate.delete("*");
//        log.info("是否删除成功：{}", delete);
//        fileService.del();
    }
}
